package com.shijianchen.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shijianchen.mapper.SpOtherAuthRuleMapper;
import com.shijianchen.projo.SpOtherAuthRule;
import com.shijianchen.service.SpOtherAuthRuleService;
import org.springframework.stereotype.Service;

import java.util.*;


@Service
public class SpOtherAuthRuleServiceImpl extends ServiceImpl<SpOtherAuthRuleMapper, SpOtherAuthRule> implements SpOtherAuthRuleService {
    @Override
    public Map<String,Object> getTrees() throws IllegalAccessException {
//        LambdaQueryWrapper<SpOtherAuthRule> wrapper = new LambdaQueryWrapper<>();
////        wrapper.eq(SpOtherAuthRule::getIsDelete,0);
////        wrapper.eq(SpOtherAuthRule::getType,0);
//        List<SpOtherAuthRule> list = baseMapper.selectList(wrapper);
//        List<SpOtherAuthRule> rules = list.stream().filter(item -> Objects.equals(item.getIsUse(), 0)).toList();
//        List<Integer> ruleIds = list.stream().filter(item -> Objects.equals(item.getIsUse(), 0)).map(SpTrees::getId).toList();
//        TreeUtils<SpOtherAuthRule> treeUtils = new TreeUtils<>((SpOtherAuthRule data)-> {
//            TreeElement<SpOtherAuthRule> treeElement = new TreeElement<>();
////            treeElement.setParentId(data.getParentId());
////            treeElement.setId(data.getId());
////            treeElement.setLabel(data.getMenuName());
////            treeElement.setTitle(data.getTitle());
////            if(data.getPath() == null){
////                treeElement.setPath("");
////            }else{
////                treeElement.setPath(data.getPath());
////            }
////
////            treeElement.setType(data.getType());
////            treeElement.setStatus(data.getStatus());
////            treeElement.setChildren(new ArrayList<>());
//            return  treeElement;
//        });
//        Map<String,Object> map = new HashMap<>();
//        map.put("menu",treeUtils.buildTree(list));
//        map.put("rule",treeUtils.buildTree(rules));
//        map.put("ruleIds",ruleIds);
        return null;
    }
}
